import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useCounterStore = defineStore('counter', () => {
  const count = ref(0)
  const doubleCount = computed(() => count.value * 2)
  function increment() {
    count.value++
  }
  function setUserState(data) {
    console.log(list);
    list.value.push(data)
  }
  const list = ref([
    {
      desc: "小藏手工酿造，百年名酒",
      id: "3494006",
      name: "梅乃宿梅酒720毫升",
      orderNum: 3,
      picture: "https://yanxuan-item.nosdn.127.net/330913911087b44b0d817dd78233165f.png",
      price: "168.00"
    },
    {
      desc: "经典产区限量单一老年份",
      id: "3463003",
      name: "法国年份雅文邑700毫升",
      orderNum: 1,
      picture: "https://yanxuan-item.nosdn.127.net/0a2fff6e0b55178fbbe99d97d94d20a8.png",
      price: "1480.00",
    },
    {
      desc: "陈年朗姆，香味芬芳",
      id: "1666009",
      name: "多米尼加陈年朗姆酒700毫升",
      orderNum: 101,
      picture: "https://yanxuan-item.nosdn.127.net/e3f387109491d92c47179d029d340b1f.jpg",
      price: "238.00",
    },
    {
      desc: "辣香麻爽，地道川渝风味",
      id: "1548007",
      name: "川味牛肉辣椒酱190克",
      orderNum: 3,
      picture: "https://yanxuan-item.nosdn.127.net/0e1681ab3a4a5aaf185f0bb123f07f99.jpg",
      price: "38.00",
    },
    {
      desc: "灵性十足的黑色招财猫，周而复始，财源不断",
      id: "4001920",
      name: "朱炳仁铜·猫型吉祥物装饰工艺摆件",
      orderNum: 5,
      picture: "https://yanxuan-item.nosdn.127.net/6e38fc94a8fe72c9d139bc48ba6d9814.jpg",
      price: "1888.00",
    },
    {
      desc: "白夜通话番外系列《海洋之歌》，温暖治愈",
      id: "4001798",
      name: "海洋之歌·艺术雕塑摆件",
      orderNum: 143,
      picture: "https://yanxuan-item.nosdn.127.net/c25af46c2d3df0cbf933dd31c5e7ad6a.jpg",
      price: "67.00"
    }

  ])


  return { count, doubleCount, increment, list, setUserState }
})
